package com.ruoyi.system.mqtt;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;


@RestController
@RequestMapping("/mqtt/api")
public class OpenMqttServer {
    private final Logger logger= LogManager.getLogger();

//    public OpenMqttServer(){
//        init();
//    }
    @GetMapping("/openMqttServer")
    private void init(){
        MqttParkClient.MQTT_CLIENTID = "msdw_"+new Date().getTime();
        MqttParkClient.CreateMqttConnection(
                MqttParkClient.MQTT_SERVER, //mqtt服务地址
                MqttParkClient.MQTT_PORT,    //mqtt端口
                MqttParkClient.MQTT_CLIENTID,   //clientId
                "test",   //登录账号
                "test"    //登录密码
        );

    }

}
